package com.aaa.member.controller.api;

import com.aaa.entity.CouponHistory;
import com.aaa.member.service.CouponHistoryService;
import com.aaa.security.annotation.MyLog;
import com.aaa.vo.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author JYH
 * @version 1.0
 * @date 2023/3/2 20:37
 */
@Api(value = "/member/api/couponHistory", tags = {"历史优惠券"})
@RestController
@RequestMapping("/member/api/couponHistory")
public class CouponHistoryController {

    @Autowired
    private CouponHistoryService couponHistoryService;

    /**
     * @author JYH
     * @date 2023/3/3 12:32
     * @description - 查询优惠券历史记录
     * @param currentPage
     * @param pageSize
     * @param cname
     */
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "query", dataType = "int", name = "currentPage", value = "", required = true),
            @ApiImplicitParam(paramType = "query", dataType = "int", name = "pageSize", value = "", required = true),
            @ApiImplicitParam(paramType = "query", dataType = "string", name = "cname", value = "", required = true)
    })
    @ApiOperation(value = "- 查询优惠券历史记录", notes = "- 查询优惠券历史记录", httpMethod = "POST")
    @MyLog(title="查询优惠券历史记录")
    @PostMapping("/selectAll")
    public Result selectAll(Integer currentPage, Integer pageSize, String cname){
        return couponHistoryService.selectAll(currentPage, pageSize, cname);
    }

    /**
     * 刘延臣
     * 支付时查询自己的优惠卷
     *
     */
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "query", dataType = "CouponHistory", name = "couponHistory", value = "", required = true)
    })
    @ApiOperation(value = "刘延臣 支付时查询自己的优惠卷", notes = "刘延臣 支付时查询自己的优惠卷", httpMethod = "POST")
    @MyLog(title="支付时查询自己的优惠卷")
    @PostMapping("/selectBymemberId")
    public Result selectBymemberId(CouponHistory couponHistory){
        return couponHistoryService.selectBymemberId(couponHistory);
    }

}
